﻿Public Class frmthesaurus
    Dim word As String
    Dim suggestion As String()
    

    Private Sub frmthesaurus_Load( sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Me.txtword.Text = frmMain.txtWord.Text
        the()
    End Sub

    Private Sub btnGet_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnGet.Click
        the()
    End Sub

    Private Sub the()
        If Me.txtword.Text <> "" Then
            word = txtword.Text.Trim(" ")
            Dim newthesaurus As New Maaharaa.dvthesaurus(word)
            lstSuggestions.Items.Clear()
            suggestion = newthesaurus.suggestions
            For Each item In suggestion
                lstSuggestions.Items.Add(item)
            Next
        End If
    End Sub

    Private Sub btnAdd_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnAdd.Click
        frmMain.rtbInput.Text &= " " & lstSuggestions.Text
    End Sub


#Region "Form Move/Drag"

    Private IsFormBeingDragged As Boolean = False
    Private MouseDownX As Integer
    Private MouseDownY As Integer

    Private Sub frmthe_MouseMove(ByVal sender As System.Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles pctback.MouseMove
        If IsFormBeingDragged Then
            Dim temp As Point = New Point()

            temp.X = Me.Location.X + (e.X - MouseDownX)
            temp.Y = Me.Location.Y + (e.Y - MouseDownY)
            Me.Location = temp
            temp = Nothing
        End If
    End Sub

    Private Sub frmthe_MouseUp(ByVal sender As System.Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles pctback.MouseUp
        If e.Button = MouseButtons.Left Then
            IsFormBeingDragged = False
        End If
    End Sub

    Private Sub frmthe_MouseDown(ByVal sender As System.Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles pctback.MouseDown
        If e.Button = MouseButtons.Left Then
            IsFormBeingDragged = True
            MouseDownX = e.X
            MouseDownY = e.Y
        End If
    End Sub
#End Region

    Private Sub PictureBox1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles PictureBox1.Click
        Me.Close()
    End Sub
End Class